diff options
| author | Sebastien Castiel <sebastien@castiel.me> | 2023-12-07 16:44:01 -0500 |
|---|---|---|
| committer | Sebastien Castiel <sebastien@castiel.me> | 2023-12-07 16:44:01 -0500 |
| commit | 0b27f90fb76a2492c17a958b6dd807e6fbbf8030 (patch) | |
| tree | bfc9c0e533eb28b43bcded9c53020dc15bca1955 /src/app/groups/[groupId]/layout.tsx | |
| parent | 6611e3a187e5398f686449938b7cf1ddbfcb5392 (diff) | |
Titles and navigation
Diffstat (limited to 'src/app/groups/[groupId]/layout.tsx')
| -rw-r--r-- | src/app/groups/[groupId]/layout.tsx | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/app/groups/[groupId]/layout.tsx b/src/app/groups/[groupId]/layout.tsx index 5b99dd2..5fbd7cb 100644 --- a/src/app/groups/[groupId]/layout.tsx +++ b/src/app/groups/[groupId]/layout.tsx @@ -1,31 +1,39 @@ import { GroupTabs } from '@/app/groups/[groupId]/group-tabs' import { SaveGroupLocally } from '@/app/groups/[groupId]/save-recent-group' -import { Button } from '@/components/ui/button' import { getGroup } from '@/lib/api' -import { ChevronLeft } from 'lucide-react' +import { Metadata } from 'next' import Link from 'next/link' import { notFound } from 'next/navigation' import { PropsWithChildren } from 'react' +type Props = { + params: { + groupId: string + } +} + +export async function generateMetadata({ + params: { groupId }, +}: Props): Promise<Metadata> { + const group = await getGroup(groupId) + + return { + title: { + default: group?.name ?? '', + template: `%s · ${group?.name} · Spliit`, + }, + } +} + export default async function GroupLayout({ children, params: { groupId }, -}: PropsWithChildren<{ - params: { groupId: string } -}>) { +}: PropsWithChildren<Props>) { const group = await getGroup(groupId) if (!group) notFound() return ( <> - <div className="mb-4 flex justify-between"> - <Button variant="ghost" asChild> - <Link href="/groups"> - <ChevronLeft className="w-4 h-4 mr-2" /> Back to recent groups - </Link> - </Button> - </div> - <h1 className="font-bold text-2xl mb-4"> <Link href={`/groups/${groupId}`}>{group.name}</Link> </h1> |
